<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_Listesreponse extends Application_Model_ModelAbstract
{

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_Idlistesreponse;

    /**
     * Database var type text
     *
     * @var text
     */
    protected $_Valuereponse;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_ReponseparticipantIdreponseparticipant;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_QuestionIdQuestion;


    /**
     * Parent relation fk_listesreponse_reponseparticipant1
     *
     * @var Application_Model_Reponseparticipant
     */
    protected $_Reponseparticipant;

    /**
     * Parent relation fk_listesreponse_Question1
     *
     * @var Application_Model_Question
     */
    protected $_Question;


    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idlistesreponse'=>'Idlistesreponse',
            'valuereponse'=>'Valuereponse',
            'reponseparticipant_idreponseparticipant'=>'ReponseparticipantIdreponseparticipant',
            'Question_idQuestion'=>'QuestionIdQuestion',
        ));

        $this->setParentList(array(
            'FkListesreponseReponseparticipant1'=> array(
                    'property' => 'Reponseparticipant',
                    'table_name' => 'Reponseparticipant',
                ),
            'FkListesreponseQuestion1'=> array(
                    'property' => 'Question',
                    'table_name' => 'Question',
                ),
        ));

        $this->setDependentList(array(
        ));
    }

    /**
     * Sets column idlistesreponse
     *
     * @param int $data
     * @return Application_Model_Listesreponse
     */
    public function setIdlistesreponse($data)
    {
        $this->_Idlistesreponse = $data;
        return $this;
    }

    /**
     * Gets column idlistesreponse
     *
     * @return int
     */
    public function getIdlistesreponse()
    {
        return $this->_Idlistesreponse;
    }

    /**
     * Sets column valuereponse
     *
     * @param text $data
     * @return Application_Model_Listesreponse
     */
    public function setValuereponse($data)
    {
        $this->_Valuereponse = $data;
        return $this;
    }

    /**
     * Gets column valuereponse
     *
     * @return text
     */
    public function getValuereponse()
    {
        return $this->_Valuereponse;
    }

    /**
     * Sets column reponseparticipant_idreponseparticipant
     *
     * @param int $data
     * @return Application_Model_Listesreponse
     */
    public function setReponseparticipantIdreponseparticipant($data)
    {
        $this->_ReponseparticipantIdreponseparticipant = $data;
        return $this;
    }

    /**
     * Gets column reponseparticipant_idreponseparticipant
     *
     * @return int
     */
    public function getReponseparticipantIdreponseparticipant()
    {
        return $this->_ReponseparticipantIdreponseparticipant;
    }

    /**
     * Sets column Question_idQuestion
     *
     * @param int $data
     * @return Application_Model_Listesreponse
     */
    public function setQuestionIdQuestion($data)
    {
        $this->_QuestionIdQuestion = $data;
        return $this;
    }

    /**
     * Gets column Question_idQuestion
     *
     * @return int
     */
    public function getQuestionIdQuestion()
    {
        return $this->_QuestionIdQuestion;
    }

    /**
     * Sets parent relation ReponseparticipantIdreponseparticipant
     *
     * @param Application_Model_Reponseparticipant $data
     * @return Application_Model_Listesreponse
     */
    public function setReponseparticipant(Application_Model_Reponseparticipant $data)
    {
        $this->_Reponseparticipant = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idreponseparticipant'];
        }

        $this->setReponseparticipantIdreponseparticipant($primary_key);

        return $this;
    }

    /**
     * Gets parent ReponseparticipantIdreponseparticipant
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_Reponseparticipant
     */
    public function getReponseparticipant($load = true)
    {
        if ($this->_Reponseparticipant === null && $load) {
            $this->getMapper()->loadRelated('FkListesreponseReponseparticipant1', $this);
        }

        return $this->_Reponseparticipant;
    }

    /**
     * Sets parent relation QuestionIdQuestion
     *
     * @param Application_Model_Question $data
     * @return Application_Model_Listesreponse
     */
    public function setQuestion(Application_Model_Question $data)
    {
        $this->_Question = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idQuestion'];
        }

        $this->setQuestionIdQuestion($primary_key);

        return $this;
    }

    /**
     * Gets parent QuestionIdQuestion
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_Question
     */
    public function getQuestion($load = true)
    {
        if ($this->_Question === null && $load) {
            $this->getMapper()->loadRelated('FkListesreponseQuestion1', $this);
        }

        return $this->_Question;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_Listesreponse
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_Listesreponse());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_Listesreponse::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdlistesreponse() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idlistesreponse = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdlistesreponse()));
    }
}
